/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package dominio;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author Cícero
 */
@Entity
@Table(name = "CHEQUE")
@NamedQueries({
    @NamedQuery(name = "Cheque.findAll", query = "SELECT c FROM Cheque c"),
    @NamedQuery(name = "Cheque.findById", query = "SELECT c FROM Cheque c WHERE c.id = :id"),
    @NamedQuery(name = "Cheque.findByNumCheque", query = "SELECT c FROM Cheque c WHERE c.numCheque = :numCheque"),
    @NamedQuery(name = "Cheque.findByConta", query = "SELECT c FROM Cheque c WHERE c.conta = :conta"),
    @NamedQuery(name = "Cheque.findByAgencia", query = "SELECT c FROM Cheque c WHERE c.agencia = :agencia"),
    @NamedQuery(name = "Cheque.findByBanco", query = "SELECT c FROM Cheque c WHERE c.banco = :banco"),
    @NamedQuery(name = "Cheque.findByDataVen", query = "SELECT c FROM Cheque c WHERE c.dataVen = :dataVen"),
    @NamedQuery(name = "Cheque.findByValor", query = "SELECT c FROM Cheque c WHERE c.valor = :valor")})
public class Cheque implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "ID")
    private Integer id;
    @Basic(optional = false)
    @Column(name = "NUM_CHEQUE")
    private int numCheque;
    @Basic(optional = false)
    @Column(name = "CONTA")
    private String conta;
    @Basic(optional = false)
    @Column(name = "AGENCIA")
    private int agencia;
    @Basic(optional = false)
    @Column(name = "BANCO")
    private String banco;
    @Basic(optional = false)
    @Column(name = "DATA_VEN")
    @Temporal(TemporalType.DATE)
    private Date dataVen;
    @Basic(optional = false)
    @Column(name = "VALOR")
    private double valor;
    @JoinColumn(name = "COD_VENDA", referencedColumnName = "CODIGOVENDA")
    @ManyToOne
    private Venda venda;
    @JoinColumn(name = "COD_COMPRA", referencedColumnName = "CODIGOCOMPRA")
    @ManyToOne
    private Compra compra;
    @OneToMany(mappedBy = "cheque")
    private List<Despesafuncionario> despesafuncionarioList;

    public Cheque() {
    }

    public Cheque(Integer id) {
        this.id = id;
    }

    public Cheque(Integer id, int numCheque, String conta, int agencia, String banco, Date dataVen, double valor) {
        this.id = id;
        this.numCheque = numCheque;
        this.conta = conta;
        this.agencia = agencia;
        this.banco = banco;
        this.dataVen = dataVen;
        this.valor = valor;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public int getNumCheque() {
        return numCheque;
    }

    public void setNumCheque(int numCheque) {
        this.numCheque = numCheque;
    }

    public String getConta() {
        return conta;
    }

    public void setConta(String conta) {
        this.conta = conta;
    }

    public int getAgencia() {
        return agencia;
    }

    public void setAgencia(int agencia) {
        this.agencia = agencia;
    }

    public String getBanco() {
        return banco;
    }

    public void setBanco(String banco) {
        this.banco = banco;
    }

    public Date getDataVen() {
        return dataVen;
    }

    public void setDataVen(Date dataVen) {
        this.dataVen = dataVen;
    }

    public double getValor() {
        return valor;
    }

    public void setValor(double valor) {
        this.valor = valor;
    }

    public Venda getVenda() {
        return venda;
    }

    public void setVenda(Venda venda) {
        this.venda = venda;
    }

    public Compra getCompra() {
        return compra;
    }

    public void setCompra(Compra compra) {
        this.compra = compra;
    }

    public List<Despesafuncionario> getDespesafuncionarioList() {
        return despesafuncionarioList;
    }

    public void setDespesafuncionarioList(List<Despesafuncionario> despesafuncionarioList) {
        this.despesafuncionarioList = despesafuncionarioList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Cheque)) {
            return false;
        }
        Cheque other = (Cheque) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "dominio.Cheque[id=" + id + "]";
    }

}
